FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime
MAINTAINER wuwanjie@datagrand.com

# 更新源, 安装SSH server
RUN apt-get -y update  \
    && apt-get -y install openssh-server openssh-client \
    && apt-get -y install vim

ENV LANG C.UTF-8

# 更新pip源
RUN mkdir ~/.pip && touch ~/.pip/pip.conf \
    && echo "[global]" >> ~/.pip/pip.conf \
    && echo "index-url = https://mirrors.aliyun.com/pypi/simple/" >> ~/.pip/pip.conf \
    && echo "trusted-host = mirrors.aliyun.com" >> ~/.pip/pip.conf

COPY requirements.txt /tmp
RUN pip install --no-cache-dir -r /tmp/requirements.txt

# 涉及root远程登录密码
RUN mkdir /var/run/sshd \
    && echo 'root:123456' | chpasswd \
    && sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config \
    && sed -ri 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config \
    && /etc/init.d/ssh restart

WORKDIR /workspace

# 开放SSH 22端口号
EXPOSE 22

CMD  ["/usr/sbin/sshd", "-D"]
